package com.zenchn.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.Date;

/**
 * HttpResult : 响应的结果对象
 *
 * @author dingxinfa
 * @date 2018-07-07
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value="无数据响应的结果对象",description="无数据响应的结果对象")
public class HttpResult implements Serializable {

    private static final long serialVersionUID = 8209266072755050480L;

    @ApiModelProperty(value="信息描述")
    private String message;


    @ApiModelProperty(value="状态码")
    private Integer status;


    @ApiModelProperty(value="错误提示")
    private String error;


    @ApiModelProperty(value="请求地址")
    private String path;


    @ApiModelProperty(value="时间戳")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss.SSS Z")
    private Date timestamp;

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public Date getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Date timestamp) {
        this.timestamp = timestamp;
    }

    public HttpResult() {
        this.timestamp =new Date();

    }

    public HttpResult(String path) {
        this.path = path;
        this.timestamp = new Date();
    }

    /**
     * 重置更新时间戳
     */
    public void resetTimestamp(){
        this.timestamp =new Date();
    }
}
